<?php
namespace QnuiRings\Controller;
use Think\Controller;
// 软件名称：互动折扣王-连环折扣-满就送折扣
// 代码日期：v3.0 2018-7-14
// 作者：杨道泉
// 文件名：QnuiMjs1Controller.class.php
// 功能： 使用千牛UI发布满就送折扣

class QnuiMjsController extends QnuiBaseController {
    public function create_mjs(){
        $name	=I("name");
        $type	=I("type");
        $participate_range	=I("participate_range");
        $start_time	=I("start_time");
        $end_time	=I("end_time");
        $is_amount_over	=I("is_amount_over");
        $total_price	=I("total_price");
        $is_amount_multiple	=I("is_amount_multiple");
        $is_item_count_over	=I("is_item_count_over");
        $item_count	=I("item_count");
        $is_item_multiple	=I("is_item_multiple");
        $is_shop_member	=I("is_shop_member");
        $shop_member_level	=I("shop_member_level");
        $is_user_tag	=I("is_user_tag");
        $user_tag	=I("user_tag");
        $is_decrease_money	=I("is_decrease_money");
        $decrease_amount	=I("decrease_amount");
        $is_discount	=I("is_discount");
        $discount_rate	=I("discount_rate");
        $is_send_gift	=I("is_send_gift");
        $gift_name	=I("gift_name");
        $gift_id	=I("gift_id");
        $gift_url	=I("gift_url");
        $is_free_post	=I("is_free_post");
        $exclude_area	=I("exclude_area");
        
            
        Vendor('taobaosdk/top/request/PromotionmiscMjsActivityAddRequest');
        $req = new \PromotionmiscMjsActivityAddRequest;
        $req->setName($name);
        $req->setType($type);
        $req->setParticipateRange($participate_range);
        $req->setStartTime($start_time);
        $req->setEndTime($end_time);
        $req->setIsAmountOver($is_amount_over);
        $req->setTotalPrice($total_price);
        $req->setIsAmountMultiple($is_amount_multiple);
        $req->setIsItemCountOver($is_item_count_over);
        $req->setItemCount($item_count);
        $req->setIsItemMultiple($is_item_multiple);
        $req->setIsShopMember($is_shop_member);
        $req->setShopMemberLevel($shop_member_level);
        $req->setIsUserTag($is_user_tag);
        $req->setUserTag($user_tag);
        $req->setIsDecreaseMoney($is_decrease_money);
        $req->setDecreaseAmount($decrease_amount);
        $req->setIsDiscount($is_discount);
        $req->setDiscountRate($discount_rate);
        $req->setIsSendGift($is_send_gift);
        $req->setGiftName($gift_name);
        $req->setGiftId($gift_id);
        $req->setGiftUrl($gift_url);
        $req->setIsFreePost($is_free_post);
        $req->setExcludeArea($exclude_area);
        $resp = pre_resp($this->c->execute($req, session("TOP_SESSION")));
        $this->ajaxReturn($resp);
    }
    public function update_mjs(){
        $activity_id = I("activity_id");
        $name	=I("name");
        $type	=I("type");
        $participate_range	=I("participate_range");
        $start_time	=I("start_time");
        $end_time	=I("end_time");
        $is_amount_over	=I("is_amount_over");
        $total_price	=I("total_price");
        $is_amount_multiple	=I("is_amount_multiple");
        $is_item_count_over	=I("is_item_count_over");
        $item_count	=I("item_count");
        $is_item_multiple	=I("is_item_multiple");
        $is_shop_member	=I("is_shop_member");
        $shop_member_level	=I("shop_member_level");
        $is_user_tag	=I("is_user_tag");
        $user_tag	=I("user_tag");
        $is_decrease_money	=I("is_decrease_money");
        $decrease_amount	=I("decrease_amount");
        $is_discount	=I("is_discount");
        $discount_rate	=I("discount_rate");
        $is_send_gift	=I("is_send_gift");
        $gift_name	=I("gift_name");
        $gift_id	=I("gift_id");
        $gift_url	=I("gift_url");
        $is_free_post	=I("is_free_post");
        $exclude_area	=I("exclude_area");
        
        
        Vendor('taobaosdk/top/request/PromotionmiscMjsActivityUpdateRequest');
        $req = new \PromotionmiscMjsActivityUpdateRequest;
        $req->setActivityId($activity_id);
        $req->setName($name);
        $req->setParticipateRange($participate_range);
        $req->setStartTime($start_time);
        $req->setEndTime($end_time);
        $req->setIsAmountOver($is_amount_over);
        $req->setTotalPrice($total_price);
        $req->setIsAmountMultiple($is_amount_multiple);
        $req->setIsItemCountOver($is_item_count_over);
        $req->setItemCount($item_count);
        $req->setIsItemMultiple($is_item_multiple);
        $req->setIsShopMember($is_shop_member);
        $req->setShopMemberLevel($shop_member_level);
        $req->setIsUserTag($is_user_tag);
        $req->setUserTag($user_tag);
        $req->setIsDecreaseMoney($is_decrease_money);
        $req->setDecreaseAmount($decrease_amount);
        $req->setIsDiscount($is_discount);
        $req->setDiscountRate($discount_rate);
        $req->setIsSendGift($is_send_gift);
        $req->setGiftName($gift_name);
        $req->setGiftId($gift_id);
        $req->setGiftUrl($gift_url);
        $req->setIsFreePost($is_free_post);
        $req->setExcludeArea($exclude_area);
        $resp = pre_resp($this->c->execute($req, session("TOP_SESSION")));
        $this->ajaxReturn($resp);
    }
    public function add_items_to_active(){
        $activity_id = I("activity_id");
        $ids = I("ids");
        Vendor('taobaosdk/top/request/PromotionmiscActivityRangeAddRequest');
        $req = new \PromotionmiscActivityRangeAddRequest;
        $req->setActivityId($activity_id);
        $req->setIds($ids);
        $resp = pre_resp($this->c->execute($req, session("TOP_SESSION")));
        $this->ajaxReturn($resp);
    }
    public function remove_mjs(){
        $activity_id = I("activity_id");
        Vendor('taobaosdk/top/request/PromotionmiscMjsActivityDeleteRequest');
        $req = new \PromotionmiscMjsActivityDeleteRequest;
        $req->setActivityId($activity_id);
        $resp = pre_resp($this->c->execute($req, session("TOP_SESSION")));
        $this->ajaxReturn($resp);
    }
}